<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class MY_Controller extends CI_Controller {

	function __construct()
	{
		parent::__construct();
		$this->check_session();
	}
	
// 	function build_menu(){
// 		$this->load->model('menu');
// 		$menu = $this->menu->get_base_menu();
// 		for($i=0;$i<count($menu);$i++){
// 			$menu[$i]['sub_menu'] = $this->menu->get_menu($menu[$i]['id_menu']);
// 		}
// 		$this->data['menus'] = $menu;
// 	}
	
	function check_session(){
		if($this->session->userdata('admin')){
			$session_data = $this->session->userdata('admin');
			$this->data['username'] = $session_data['username'];
		}else{
			redirect('','refresh');
		}
	}
}
?>